package com.acme.bankapp.domain.bank;

public class SavingsAccount extends AbstractAccount {
	
	public SavingsAccount(double balance) throws Exception {
		super(balance);
	}
	
	public void withDraw(double x) throws Exception {
		if (x <= 0)
			throw new Exception(MES_NEGATIVE_DEPOSIT);
		else if (balance < x) 
			throw new Exception(MES_TOO_SMALL_BALANCE);
		
		balance -= x;
	}

	@Override
	public double maximumAmountToWithdraw() {
		return balance;
	}	
	
	public double getBalance() {
		return balance;
	}
	
	public String toString() {
		return "Account:" + "balance = " + balance;
	}
}
